'#Language "WWB-COM"

Option Explicit

Sub Main

Dim i As Integer

Dim s2 As String

Dim s3 As String

Dim s As String

s2 = "C:\Reaserch\Code\CEM\AntennaGPT\data\Refpa\data"
s3 = ".obj"
s = ""
For i = 0 To 2
	s = ""
	s = s2 & CStr(i)
	s = s & s3

	With OBJ
	    .Reset
	    .Name  "test"
	    .Layer  "component1"
	    .FileName  s
	    .ImportToActiveCoordinateSystem  "True"
	    .ScaleToUnit  "0"
	    .ImportFileUnits  "m"
	    .ScaleFactor  "1.0"
	    .KeepShapesSeparate  "True"
	    .KeepShapeNames  "True"
	    .Read
	End With
    Pick.PickFaceFromId "component1:test",0
    With Extrude
        .Reset
        .Name ("patch")
        .Component ("component1")
        .Material ("PEC")
        .Mode ("Picks")
        .Height ("metal_thickness")
        .Taper (0)
        .UsePicksForHeight (False)
        .DeleteBaseFaceSolid (False)
        .ClearPickedFace (True)
        .Create
    End With

	Solver.Start
	Dim s11Path As String
	s11Path = "C:\Reaserch\Code\CEM\AntennaGPT\data\Refpa\" & "data" & CStr(i)
    With TOUCHSTONE
    	.Reset
        .FileName s11Path
        .Impedance (100)
        .FrequencyRange ("Full")
        .Renormalize (False)
        .UseARResults (False)
        .SetNSamples (1001)
        .Format ("DB")
        .Write
    End With
	'With Resulttree
	'	Dim ffname As String, sExcit As String
	'	Dim sResultFile As String
	'	Dim sPath As String
	'	sPath = "C:\Reaserch\Code\CEM\AntennaGPT\data\Refpa\Farfiled\" & "data" & CStr(i) & "\"
	'	ffname = .GetFirstChildName("Farfields")
	'	If (ffname = "Farfields\Farfield Cuts") Then ffname = .GetNextItemName(ffname)
	'	While (ffname <> "")
	'			SelectTreeItem ffname
	'			sResultFile = sPath+Mid(ffname,11) + ".txt"
	'		    With ASCIIExport
	'		        .Reset
	'		        .FileName sResultFile
	'		        .Mode ("FixedNumber")
	'		        .Execute
	'	        End With
	'	        ffname = .GetNextItemName(ffname)
    '    Wend
    'End With
    DeleteResults
	Solid.Delete "component1:test"
	Solid.Delete "component1:patch"
Next i


End Sub
